What is a Grid-View?
பல வலைப்பக்கங்கள் ஒரு கிரிட்-வியூவை அடிப்படையாகக் கொண்டவை, அதாவது பக்கம் வரிசைகள் மற்றும் நெடுவரிசைகளாகப் பிரிக்கப்பட்டுள்ளது.
ஒரு பதிலளிக்கும் கிரிட்-வியூ பொதுவாக 6 அல்லது 12 நெடுவரிசைகளைக் கொண்டிருக்கும், மேலும் நீங்கள் உலாவி சாளரத்தை மறுஅளவிடும்போது சுருங்கி விரிவடையும்.
Building a Grid View
கிரிட்-வியூ கட்டுமானத்தைத் தொடங்குவோம்.
முதலில் அனைத்து HTML உறுப்புகளும் box-sizing பண்புத்தொகுப்பு border-box என அமைக்கப்பட்டுள்ளதா என உறுதிப்படுத்தவும். இது உறுப்புகளின் மொத்த அகலம் மற்றும் உயரத்தில் padding மற்றும் border ஆகியவை சேர்க்கப்பட்டுள்ளதை உறுதி செய்கிறது.
உங்கள் CSS இன் மேலே பின்வருவனவற்றைச் சேர்க்கவும்:
* {
box-sizing: border-box;
}
box-sizing பண்புத்தொகுப்பைப் பற்றி மேலும் அறிய எங்கள் CSS Box Sizing அத்தியாயத்தைப் படிக்கவும்.
The HTML
ஐந்து கிரிட் உருப்படிகளுடன் (header, menu, content, facts, footer) ஒரு கிரிட் கொண்டகனரை நாங்கள் உருவாக்குகிறோம்:
<div class="grid-container">
<div class="header"><h1>Chania</h1></div>
<div class="menu">
<ul>
<li>The Flight</li>
<li>The City</li>
<li>The Island</li>
<li>The Food</li>
</ul>
</div>
<div class="content">
<h1>The City</h1>
<p>Chania is the capital of the Chania region on the island of Crete.</p>
<p>The city can be divided in two parts, the old town and the modern city.</p>
<p>Chania lies along the north west coast of the island Crete.</p>
</div>
<div class="facts">
<h2>Facts:</h2>
<ul>
<li>Chania is a city on the island of Crete</li>
<li>Crete is a Greek island in the Mediterranean Sea</li>
</ul>
</div>
<div class="footer"><p>A footer.</p></div>
</div>
The CSS
மேம்பட்ட தோற்றத்திற்கு சில பாணிகள் மற்றும் நிறங்களைச் சேர்க்கவும்:
குறிப்பு:
வெவ்வேறு திரை அளவுகளுக்கு mediaqueries மற்றும் breakpoints சேர்க்க அடுத்த அத்தியாயத்தைப் பாருங்கள்!
Example
* {
box-sizing: border-box;
}
body {
font-family: "Lucida Sans", sans-serif;
font-size: 17px;
}
.grid-container {
display: grid;
grid-template-areas:
'header'
'menu'
'main'
'facts'
'footer';
background-color: white;
gap: 10px;
}
.header {
grid-area: header;
background-color: purple;
text-align: center;
color: #ffffff;
}
.header > h1 {
font-size: 40px;
}
.menu {
grid-area: menu;
}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menu li {
padding: 8px;
margin-bottom: 7px;
background-color: #33b5e5;
color: #ffffff;
}
.menu li:hover {
background-color: #0099cc;
}
.content {
grid-area: main;
}
.content > h1 {
font-size: 30px;
margin-bottom: 7px;
}
.content > p {
margin-bottom: 7px;
}
.facts {
grid-area: facts;
border: 1px solid #0099cc;
background-color: beige;
padding: 10px;
}
.facts > h2 {
font-size: 20px;
}
.facts li {
margin-bottom: 5px;
}
.footer {
grid-area: footer;
background-color: #0099cc;
color: #ffffff;
text-align: center;
}
Exercise
பயிற்சி:
padding மற்றும் borders மொத்த அகலம் மற்றும் உயரத்தில் சேர்க்கப்பட்டுள்ளதை உறுதி செய்ய சரியான பண்புத்தொகுப்பு பெயரை இழுத்து விடவும்.
* {
: border-box;
}